package com.touni.designpattern.builderpattern;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName : Meal
 * @Description :
 * @Author : lwq
 * @Date: 2020-10-20 19:03
 */
public class Meal {
    private List<Item> itemList = new ArrayList<>();

    public void addItem(Item item){
        itemList.add(item);
    }

    public void outputMeals(){
        double totalPrice = 0;
        for (Item item : itemList){
            System.out.println("item: " + item.name());
            System.out.println("pack: " + item.pack().pack());
            System.out.println("price: " + item.price());
            totalPrice = totalPrice + item.price();
        }
        System.out.println("total price: " + totalPrice);
    }

}
